package com.skydonkey.properties;

import com.qiniu.util.Auth;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
@ConfigurationProperties(prefix = "qiniu")
public class QiniuProperties {

    public static final String CONVERT_FLV_PIPELINE = "";
    public static final String CONVERT_FLV_SAVE_AS = "/flv/";

    public static final String ORIGIN_VIDEO = "/origin/";



    private Auth auth;
    private String accessKey;
    private String secretKey;
    private String bucket;
    private String bucketDomain;
    private String notifyURL;

    @PostConstruct
    public void init(){
        this.auth = Auth.create(accessKey, secretKey);
    }

    public String getBucketDomain() {
        return bucketDomain;
    }

    public void setBucketDomain(String bucketDomain) {
        this.bucketDomain = bucketDomain;
    }

    public String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }

    public String getBucket() {
        return bucket;
    }

    public void setBucket(String bucket) {
        this.bucket = bucket;
    }

    public Auth getAuth() {
        return auth;
    }

    public QiniuProperties setAuth(Auth auth) {
        this.auth = auth;
        return this;
    }

    public String getNotifyURL() {
        return notifyURL;
    }

    public QiniuProperties setNotifyURL(String notifyURL) {
        this.notifyURL = notifyURL;
        return this;
    }

    @Override
    public String toString() {
        return "QiniuProperties{" +
                "auth=" + auth +
                ", accessKey='" + accessKey + '\'' +
                ", secretKey='" + secretKey + '\'' +
                ", bucket='" + bucket + '\'' +
                ", bucketDomain='" + bucketDomain + '\'' +
                ", notifyURL='" + notifyURL + '\'' +
                '}';
    }
}
